<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/29
 * Time: 10:25
 */
header("Content-Type:application/json;charset=utf-8");
header("Access-Control-Allow-Origin:*");

session_start();
if($_SERVER["REQUEST_METHOD"]=="POST"){

    $result=array("status"=>0,"msg"=>"您还未登录,请先登录");
   if(isset($_SESSION["userinfo"])){
       // 如果判断你登录e,就返回登陆者的信息给你
       $result["status"]=1;
       $result["msg"]="欢迎您";
       $result["data"]=$_SESSION["userinfo"];
       print_r(json_encode($result));
       // {status:1,msg:欢迎您,data{uid:1,xxx:xxx,}}
   }else{
       //如果没有登录,返回没有登录状态
       print_r(json_encode($result));
   }
}

